#include"comm.hpp"

int main(){
    key_t k = getkey();

    int shmid = creatshm(k);
    printf("shmid:%d\n",shmid);

    //挂接
    char* s = (char*)attachshm(shmid);//初始地址
    printf("挂接成功，初始地址为:%p\n",s);

    //开始通信:服务端读取
    while(true){
        printf("server say: %s",s);
        sleep(1);
    }







    //去关联
    sleep(5);
    unlink_shm(s);

    //释放
    sleep(5);
    delshm(shmid);

    return 0;
}